package system

import (
	"MoSkeleton/framework/core/models"
	"MoSkeleton/models/base"
	"database/sql"
	"gorm.io/gorm"
)

type SysPost struct {
	models.MoModel
	PostCode  string         `gorm:"column:post_code;type:VARCHAR(64);NOT NULL"`
	PostName  string         `gorm:"column:post_name;type:VARCHAR(50);NOT NULL"`
	PostSort  int32          `gorm:"column:post_sort;type:INT;NOT NULL"`
	Status    string         `gorm:"column:status;type:CHAR(1);NOT NULL"`
	CreatedBy string         `gorm:"column:created_by;type:VARCHAR(64);"`
	UpdatedBy string         `gorm:"column:updated_by;type:VARCHAR(32);"`
	Remark    sql.NullString `gorm:"column:remark;type:VARCHAR(500);"`
}

func (p *SysPost) TableName() string {
	return "sys_post"
}

func (p *SysPost) UpdatePostById(tx *gorm.DB) error {
	return base.GetModelDB(tx).Updates(p).Error
}
